package com.hmy.finance.common.constants;


import com.hmy.finance.api.bo.core.request.enums.ReceiptOffsetBillQueryStatusEnum;
import com.hmy.finance.api.bo.core.request.enums.ReceiptOffsetBillStatusEnum;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ReceiptOffsetStatusConstant {

    public static final Map<Integer, List<Integer>> RECEIPT_OFFSET_QUERY_STATUS_MAPPING = new HashMap<>(2 >> 4);

    static {
        RECEIPT_OFFSET_QUERY_STATUS_MAPPING.put(ReceiptOffsetBillQueryStatusEnum.AREA_MANAGER_APPROVE_ING.getStatusCode(),
                Arrays.asList(ReceiptOffsetBillStatusEnum.AREA_MANAGER_APPROVE_ING.getStatusCode(),
                        ReceiptOffsetBillStatusEnum.CASHIER_APPROVE_ING.getStatusCode(),
                        ReceiptOffsetBillStatusEnum.ARACCOUNTANT_APPROVE_ING.getStatusCode()
                ));
        RECEIPT_OFFSET_QUERY_STATUS_MAPPING.put(ReceiptOffsetBillQueryStatusEnum.FINISHED.getStatusCode(),
                Arrays.asList(ReceiptOffsetBillStatusEnum.OFFSET_SUCCESS.getStatusCode(),
                        ReceiptOffsetBillStatusEnum.APPROVE_PASS.getStatusCode(),
                        ReceiptOffsetBillStatusEnum.OFFSET_FAILED.getStatusCode()
                ));
        RECEIPT_OFFSET_QUERY_STATUS_MAPPING.put(ReceiptOffsetBillQueryStatusEnum.REVOKE.getStatusCode(),
                Arrays.asList(ReceiptOffsetBillStatusEnum.REVOKE.getStatusCode()));

        RECEIPT_OFFSET_QUERY_STATUS_MAPPING.put(ReceiptOffsetBillQueryStatusEnum.REJECTED.getStatusCode(),
                Arrays.asList(ReceiptOffsetBillStatusEnum.APPROVE_REJECTED.getStatusCode()
                ));
        RECEIPT_OFFSET_QUERY_STATUS_MAPPING.put(ReceiptOffsetBillQueryStatusEnum.CANCEL.getStatusCode(),
                Arrays.asList(ReceiptOffsetBillStatusEnum.CANCEL.getStatusCode()));

        RECEIPT_OFFSET_QUERY_STATUS_MAPPING.put(ReceiptOffsetBillQueryStatusEnum.DRAFT.getStatusCode(),
                Arrays.asList(ReceiptOffsetBillStatusEnum.DRAFT.getStatusCode()));

        RECEIPT_OFFSET_QUERY_STATUS_MAPPING.put(
                ReceiptOffsetBillQueryStatusEnum.FINANCE_MANAGER_FINISHED.getStatusCode(),
                Arrays.asList(ReceiptOffsetBillStatusEnum.OFFSET_SUCCESS.getStatusCode()));

    }


    /**
     * 单据可以被编辑的状态合集
     */
    public static final List<Integer> BILL_STATUS_CAN_EDIT = Arrays.asList(
            ReceiptOffsetBillStatusEnum.DRAFT.getStatusCode(),
            ReceiptOffsetBillStatusEnum.REVOKE.getStatusCode(),
            ReceiptOffsetBillStatusEnum.CANCEL.getStatusCode(),
            ReceiptOffsetBillStatusEnum.APPROVE_REJECTED.getStatusCode()
    );

    /**
     * 单据可以被删除的状态合集
     */
    public static final List<Integer> BILL_STATUS_CAN_DELETE = Arrays.asList(
            ReceiptOffsetBillStatusEnum.DRAFT.getStatusCode(),
            ReceiptOffsetBillStatusEnum.REVOKE.getStatusCode(),
            ReceiptOffsetBillStatusEnum.CANCEL.getStatusCode()
    );

    /**
     * 单据可以被提交的状态合集
     */
    public static final List<Integer> BILL_STATUS_CAN_SUBMIT = Arrays.asList();

    /**
     * 单据可以被撤销的状态合集
     */
    public static final List<Integer> BILL_STATUS_CAN_REVOKED = Arrays.asList(
            ReceiptOffsetBillStatusEnum.AREA_MANAGER_APPROVE_ING.getStatusCode(),
            ReceiptOffsetBillStatusEnum.CASHIER_APPROVE_ING.getStatusCode(),
            ReceiptOffsetBillStatusEnum.ARACCOUNTANT_APPROVE_ING.getStatusCode()
    );

    /**
     * 单据可以被作废的状态合集
     */
    public static final List<Integer> BILL_STATUS_CAN_CANCEL = Arrays.asList(
            ReceiptOffsetBillStatusEnum.APPROVE_REJECTED.getStatusCode(),
            ReceiptOffsetBillStatusEnum.REVOKE.getStatusCode()
    );

    /**
     * 单据可以被审核的状态合集
     */
    public static final List<Integer> BILL_STATUS_CAN_APPROVE_ING = Arrays.asList(
            ReceiptOffsetBillStatusEnum.AREA_MANAGER_APPROVE_ING.getStatusCode(),
            ReceiptOffsetBillStatusEnum.CASHIER_APPROVE_ING.getStatusCode(),
            ReceiptOffsetBillStatusEnum.ARACCOUNTANT_APPROVE_ING.getStatusCode()
    );

}
